home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / tsrcom16.arc / MARK.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-03-08  |  2.8 KB  |  78 lines

  1. ;MARK.ASM - mark a position in memory,
  2. ;           above which TSRs will later be cleared by RELEASE.COM
  3. ;           MARK can be called multiple times, each RELEASE will clear
  4. ;           above the last MARK called.
  5. ;
  6. ; VERSION 1.4  2/23/86
  7. ;   This version also stores the EMS page map so that RELEASE can release
  8. ;   READY! and any future resident programs using expanded memory
  9. ; VERSION 1.5  2/28/86
  10. ;   to keep consistent with MAPMEM and RELEASE
  11. ; VERSION 1.6  3/8/86
  12. ;   store all 256 interrupts, but only 32 EMS blocks
  13. ;
  14. ; If MARK is called with something on the command line, that text will
  15. ; be stored in the program segment prefix at offset 80H, where it is
  16. ; later accessible to RELEASE for a "named" release.
  17. ;
  18. ; written for CHASM (CHeap ASseMbler)
  19. ; by Kim Kokkonen, TurboPower Software
  20. ; telephone: 408-378-3672, Compuserve 72457,2131
  21. ;
  22. mark   proc    near
  23.        jmp     install
  24.  
  25. idstr  db      'MARK PARAMETER BLOCK FOLLOWS' ;used to find this TSR
  26. dummy  db      0               ;puts vector table on an even paragraph boundary
  27. vector ds      400H,0          ;holds vector table (0..FF)*4 at invocation time
  28. emscnt db      0,0             ;holds number of active pages in map that follows
  29. emsmap ds      80H,0           ;holds EMS page map if installed
  30.  
  31. install
  32.  
  33. ;store the interrupt vector table
  34.        push    ds
  35.        mov     cx,200H         ;512 integers to store
  36.        xor     ax,ax
  37.        mov     ds,ax           ;source address segment 0
  38.        xor     si,si           ;offset 0
  39.        mov     di,offset(vector) ;destination offset, es=cs already
  40.        cld                     ;copy up
  41.        rep
  42.        movsw                   ;copy vectors to our table
  43.  
  44. ;determine whether EMS is present
  45.        pop     ds
  46.        mov     dx,offset(emsnm)
  47.        mov     ax,3D00H
  48.        int     21H
  49.        jb      gores           ;ems driver not installed
  50.  
  51. ;EMS present, store the page map
  52.        mov     ah,4DH
  53.        mov     di,offset(emsmap) ;es=cs already
  54.        xor     bx,bx
  55.        int     67H
  56.        cmp     ah,0
  57.        jnz     gores           ;error, ignore this step
  58.  
  59. ;store the number of active handles
  60.        mov     emscnt,bx       ;count of active handles
  61.  
  62. ;print message and TSR
  63. gores  mov     dx,offset(didit)
  64.        mov     ah,9
  65.        int     21H             ;write success message
  66.        mov     dx,offset(install) ;get end of resident portion
  67.        mov     cx,4
  68.        shr     dx,cl           ;convert to paragraphs
  69.        inc     dx              ;round up
  70.        mov     ax,3100H
  71.        int     21H             ;terminate and stay resident
  72.        endp
  73.  
  74. ;success message and version number
  75. didit  db      13,10,'MARK 1.6 - Marked current memory position',13,10,36
  76. ;file name for testing EMS presence
  77. emsnm  db      'EMMXXXX0',0
  78.